/*******************************************************************************
 * Copyright (c) 2011 LegSem.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl-3.0.txt
 * 
 * Contributors:
 *     LegSem - initial API and implementation
 ******************************************************************************/
package com.legsem.legstar.cci;


import javax.resource.cci.ResourceAdapterMetaData;

import com.legsem.legstar.LegStarMetaData;

public abstract class LegStarResourceAdapterMetaDataImpl extends
        LegStarMetaData implements ResourceAdapterMetaData {

    private static final String ADAPTER_VERSION_KEY = "adapter.version";
    private static final String ADAPTER_VENDOR_NAME_KEY = "adapter.vendor.name";
    private static final String ADAPTER_NAME_KEY = "adapter.name";
    private static final String ADAPTER_DESCRIPTION_KEY = "adapter.description";
    private static final String SPEC_VERSION_KEY = "spec.version";

    private static final String[] INTERACTION_SPECS_SUPPORTED = { "com.legsem.legstar.cci.LegStarInteractionSpecImpl" };

    public LegStarResourceAdapterMetaDataImpl(Class <? extends LegStarMetaData> clazz) {
        super(clazz);
    }

    /**
     * @see ResourceAdapterMetaData#getAdapterVersion()
     */
    public String getAdapterVersion() {

        return getMetadata().getProperty(ADAPTER_VERSION_KEY);
    }

    /**
     * @see ResourceAdapterMetaData#getAdapterVendorName()
     */
    public String getAdapterVendorName() {

        return getMetadata().getProperty(ADAPTER_VENDOR_NAME_KEY);
    }

    /**
     * @see ResourceAdapterMetaData#getAdapterName()
     */
    public String getAdapterName() {

        return getMetadata().getProperty(ADAPTER_NAME_KEY);
    }

    /**
     * @see ResourceAdapterMetaData#getAdapterShortDescription()
     */
    public String getAdapterShortDescription() {

        return getMetadata().getProperty(ADAPTER_DESCRIPTION_KEY);
    }

    /**
     * @see ResourceAdapterMetaData#getSpecVersion()
     */
    public String getSpecVersion() {

        return getMetadata().getProperty(SPEC_VERSION_KEY);
    }

    /**
     * @see ResourceAdapterMetaData#getInteractionSpecsSupported()
     */
    public String[] getInteractionSpecsSupported() {

        return INTERACTION_SPECS_SUPPORTED;
    }

    /**
     * @see ResourceAdapterMetaData#supportsExecuteWithInputAndOutputRecord()
     */
    public boolean supportsExecuteWithInputAndOutputRecord() {

        return false;
    }

    /**
     * @see ResourceAdapterMetaData#supportsExecuteWithInputRecordOnly()
     */
    public boolean supportsExecuteWithInputRecordOnly() {

        return false;
    }

    /**
     * @see ResourceAdapterMetaData#supportsLocalTransactionDemarcation()
     */
    public boolean supportsLocalTransactionDemarcation() {

        return true;
    }

}
